﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HotelResSystem2
{
    public static class DiscountFactory
    {
        public static Discount GetAAADiscount()
        {
            // Implicitly upcasted to abstract class
            return new DiscountAAA();
        }

        public static Discount GetAARPDiscount()
        {
            // Implicitly upcasted to abstract class
            return new DiscountAARP();
        }

        public static Discount GetCompDiscount()
        {
            // Implicitly upcasted to abstract class
            return new DiscountComp();
        }

        public static Discount GetLastMinuteDiscount()
        {
            // Implicitly upcasted to abstract class
            return new DiscountLastMinute();
        }

        public static Discount GetRackRateDiscount()
        {
            // Implicitly upcasted to abstract class
            return new DiscountRackRate();
        }

        public static Discount GetDiscount(string discount)
        {
            if (discount == null)
            {
                return null;
            }
            switch (discount)
            {
                case DiscountAAA.XML_TAG:
                    return new DiscountAAA();
                case DiscountAARP.XML_TAG:
                    return new DiscountAARP();
                case DiscountComp.XML_TAG:
                    return new DiscountComp();
                case DiscountLastMinute.XML_TAG:
                    return new DiscountLastMinute();
                case DiscountRackRate.XML_TAG:
                    return new DiscountRackRate();
                default:
                    return null;
            }
        }

        public static List<Discount> getDiscountList()
        {

            List<Discount> discountList = new List<Discount>();
            discountList.Add(GetRackRateDiscount());
            discountList.Add(GetAAADiscount());
            discountList.Add(GetAARPDiscount());
            discountList.Add(GetCompDiscount());
            discountList.Add(GetLastMinuteDiscount());

            return discountList;
        }
    }
}
